'use strict';
import gulp from "gulp";
import env from "gulp-env";
import browserSync, { reload } from 'browser-sync';
let buildDist = require('./build/gulp-build.js');

gulp.task("before",(done)=>{
    console.log('--------before---------');
    done();
});
gulp.task("after",(done)=>{
    console.log('--------after---------');
    done();
});

gulp.task("serve:build",()=>{
    browserSync({
        server: {
            baseDir: 'dist/',
            routes: {
                "/node_modules": "node_modules"
            }
        }
    });
});
gulp.task("serve:dev",()=>{
    browserSync({
        server: {
            baseDir: 'distDev/',
            routes: {
                "/node_modules": "node_modules"
            }
        }
    });
});
/*parallel*/
gulp.task("dev",gulp.series('before',(done)=>{
    env.set({
        BUILD_TEST: 'builddev'
     });
    buildDist(()=>{
        done();
    });
},'after',"serve:dev"));
gulp.task("build",gulp.series('before',(done)=>{
    /*env.set({
        BUILD_TEST: 'builddev'
     });*/
    buildDist(()=>{
        done();
    });
},'after',"serve:build"));
gulp.task("serve:note",()=>{
    browserSync({
        server: {
            baseDir: 'note/',
            routes: {
                "/node_modules": "node_modules"
            }
        }
    });
});